home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -in_the_mag- / program_perfection / text.h < prev    next >
C/C++ Source or Header  |  1999-12-08  |  1KB  |  67 lines

  1. #ifndef TEXT_H
  2. #define TEXT_H
  3.  
  4. /*
  5.  *
  6.  * $Id :$
  7.  * $Log:$
  8.  *
  9.  */
  10.  
  11. #ifndef  DEFS_H
  12. #include "defs.h"
  13. #endif
  14.  
  15. #ifndef  ERRORS_H
  16. #include "errors.h"
  17. #endif
  18.  
  19. #ifndef  LINES_H
  20. #include "lines.h"
  21. #endif
  22.  
  23. #ifndef  EXEC_LISTS_H
  24. #include <exec/lists.h>
  25. #endif
  26.  
  27.  
  28. typedef UWORD           TEXT_LEN_TYPE;
  29. #define MAX_TEXT_LEN    65534
  30.  
  31.  
  32. struct Text
  33. {
  34.     struct MinList  Contents;   /* linked list of lines constitutes this text */
  35.     TEXT_LEN_TYPE   Length;     /* number of lines in said list */
  36.     LINE_LEN_TYPE   MaxWidth;   /* the longest line in the list */
  37. };
  38.  
  39. typedef struct Text  TEXT_TYPE;
  40. typedef struct Text *TEXT_PTR;
  41.  
  42.  
  43. struct TextPos
  44. {
  45.     TEXT_PTR        Line;
  46.     LINE_LEN_TYPE   Column;
  47. };
  48.  
  49.  
  50. typedef struct TextPos  TEXT_POS_TYPE;
  51. typedef struct TextPos *TEXT_POS_PTR;
  52.  
  53.  
  54.  
  55. TEXT_PTR        Text_New( const STRPTR contents, ERROR_TYPE *err_code );
  56. VOID            Text_Dispose( TEXT_PTR text );
  57. LINE_PTR        Text_GetTopLine( const TEXT_PTR text );
  58. LINE_PTR        Text_GetBottomLine( const TEXT_PTR text );
  59. LINE_PTR        Text_GetNextLine( const TEXT_PTR text, const LINE_PTR line );
  60. LINE_PTR        Text_GetPrevLine( const TEXT_PTR text, const LINE_PTR line );
  61. LINE_PTR        Text_GetNthLine( const TEXT_PTR text, LINE_LEN_TYPE line );
  62. TEXT_LEN_TYPE   Text_GetNoOfLines( const TEXT_PTR text );
  63. LINE_LEN_TYPE   Text_GetMaxWidth( const TEXT_PTR text );
  64.  
  65. #endif /* TEXT_H */
  66.  
  67.